import type { InjectionKey, ComputedRef, Ref } from 'vue';
import { createContext, useContext } from '/@/hooks/core/useContext';

export interface ContextProps {
  contentHeight: ComputedRef<number>;
  pageHeight: Ref<number>;
  setPageHeight: (height: number) => Promise<void>;
}

const key: InjectionKey<ContextProps> = Symbol();

export function createSiderbarContext(context: ContextProps) {
  return createContext<ContextProps>(context, key, { native: true });
}

export function useSiderbarContext() {
  return useContext<ContextProps>(key);
}
